#!/bin/bash

# конвертируем спектры звезд
(
  cd db/pickles/dat
  
  for f in *.dat ; do

#     f="ukwf5v.dat"

     echo $f

     r=`echo $f | sed  "s/\.[^\.]*$/\.enc/"`

     (cd ../../../ &&  cat "db/pickles/dat/$f" | awk '{print substr($_, 1, 7), " ", substr($_, 8, 10)}' | ./encode "db/pickles/$r")
 
  done
)

#
(
   echo "vega.sed"
   cat "db/vega.sed" | ./encode "db/vega.enc"

   echo "v.dat"
   cat "db/filter/dat/v.dat" | ./encode "db/filter/v.enc"
   
   echo "mr.dat"
   cat "db/dev/dat/mr.dat" | ./encode "db/dev/mr.enc"
   
   echo "qe.dat"
   cat "db/dev/dat/qe.dat" | ./encode "db/dev/qe.enc"
   
   echo "bs_t.dat"
   cat "db/dev/dat/bs_t.dat" | ./encode "db/dev/bs_t.enc"
   
   echo "bs_r.dat"
   cat "db/dev/dat/bs_r.dat" | ./encode "db/dev/bs_r.enc"
)